//
//  UIButton+Lc.h
//  18Birdies
//
//  Created by Lc on 15/3/31.
//  Copyright (c) 2015年 Lc. All rights reserved.
//

#import <UIKit/UIKit.h>

@class LcFont;

typedef void (^OnClickedHandler)(id sender);
typedef void (^OnClickedBoxHandler)(BOOL isSelectedCheckBox);

typedef void (^OnIndexClickedHandler)(int index);

@interface UIButton (Lc)

+ (UIButton*)commonDarkNavigationButtonWithTitle:(NSString*)title
                                          target:(id)target
                                          action:(SEL)action;
+ (UIButton*)commonWhiteNavigationButtonWithTitle:(NSString*)title
                                           target:(id)target
                                           action:(SEL)action;
+ (UIButton*)commonWhiteNavigationButtonWithTitle:(NSString*)title
                                           target:(id)target
                                           action:(SEL)action
                                             font:(LcFont*)font;
+ (UIButton*)commonBlueNavigationButtonWithTitle:(NSString*)title
                                          target:(id)target
                                          action:(SEL)action;
+ (UIButton*)commonBlueBackButtonWithTitle:(NSString*)title target:(id)target action:(SEL)action;
+ (UIButton*)commonDarkBackButtonWithTitle:(NSString*)title target:(id)target action:(SEL)action;
+ (UIButton*)commonWhiteBackButtonWithTitle:(NSString*)title target:(id)target action:(SEL)action;

+ (UIButton*)closeButtonWithTarget:(id)target action:(SEL)action;
+ (UIButton*)whiteCloseButtonWithTarget:(id)target action:(SEL)action;
+ (UIButton*)refreshButtonWithTarget:(id)target action:(SEL)action;
+ (UIButton*)moreButtonWithTarget:(id)target action:(SEL)action;
+ (UIButton*)searchButtonWithTarget:(id)target action:(SEL)action;
+ (UIButton*)shareButtonWithTarget:(id)target action:(SEL)action;
+ (UIButton*)rightNavigationButtonWithTarget:(id)target
                                      action:(SEL)action
                                   imageName:(NSString*)imageName;
+ (UIButton*)rightNavigationButtonWithTarget:(id)target
                                      action:(SEL)action
                             normalImageName:(NSString*)normalImageName
                        highlightedImageName:(NSString*)highlightedImageName;

+ (UIButton*)customButtonWithImageName:(NSString*)imageName target:(id)target action:(SEL)action;
+ (UIButton*)customButtonWithTitle:(NSString*)title
                         imageName:(NSString*)imageName
                            target:(id)target
                            action:(SEL)action;

- (void)setNormalStateTitleWithUnderlineString:(NSString*)string lcFont:(LcFont*)lcFont;

- (void)setBlueStyle;
- (void)setBlueStyleWithRoundCorner:(BOOL)roundCorner;
- (void)setSmallBlueStyle;
- (void)setBlueBorderedStyle;
- (void)setSmallBlueBorderedStyle;
- (void)setWhiteBorderedStyle;
- (void)setSmallWhiteBorderedStyle;
- (void)setRoundWhiteBorderedStyle;
- (void)setSmallRoundWhiteBorderedStyle;
- (void)setSmallerRoundWhiteBorderedStyle;
- (void)setGrayBorderedStyle;
- (void)setBlueCellStyle;
- (void)setBlueNoBgImageStyle;
- (void)setBlueLinerGradientStyle;
- (void)setDarkCellStyle;
- (void)setGrayCellStyle;
- (void)setGrayStyle;
- (void)setSecondaryGrayStyle;
- (void)setWhiteBackgroundStyle:(UIColor*)titleColor;
- (void)setWhiteStyle;
- (void)setWhiteStyleWithoutRoundCorner;
- (void)setWhiteNoBgImageStyle;
- (void)setDisableStyle;
- (void)setRedFontStyle;
- (void)setRedFontBorderedStyle;
- (void)setOrangeCellStyle;
- (void)setOrangeStyle;
- (void)setOrangeStyleWithoutRoundCorner;
- (void)setRedStyle;
- (void)setCommonNavigationStyle;
- (void)setCommonBackStyle;

- (void)enableRoundCorner;

- (void)setLcFont:(LcFont*)lcFont;

- (void)setTitle:(NSString*)title;
- (void)setAttributedTitle:(NSAttributedString*)title;

/*
 * add image like: "title >" or "> title"
 *
 * Can be called more than once, but only have one image on button.
 * Usually, if button has background: forAllState use YES; else use NO
 */
- (void)addImage:(UIImage*)image rightMargin:(float)rightMargin;
- (void)addImage:(UIImage*)image rightMargin:(float)rightMargin forAllState:(BOOL)forAllState;
- (void)addImage:(UIImage*)image leftMargin:(float)leftMargin;
- (void)addImage:(UIImage*)image leftMargin:(float)leftMargin forAllState:(BOOL)forAllState;

- (void)setBackgroundImage:(UIImage*)image forAllState:(BOOL)forAllState;
- (void)setImage:(UIImage*)image forAllState:(BOOL)forAllState;

/**
 *  Use these methods to create buttons compatible with AutoLayout
 */
+ (UIButton*)commonNavigationButtonCompatibleWithAutoLayoutWithTitle:(NSString*)title
                                                              target:(id)target
                                                              action:(SEL)action;
+ (UIButton*)commonWhiteNavigationButtonCompatibleWithAutoLayoutWithTitle:(NSString*)title
                                                                   target:(id)target
                                                                   action:(SEL)action;
+ (UIButton*)commonBackButtonCompatibleWithAutoLayoutWithTitle:(NSString*)title
                                                        target:(id)target
                                                        action:(SEL)action;
+ (UIButton*)closeButtonCompatibleWithAutoLayoutWithTarget:(id)target action:(SEL)action;

- (void)startLoadingIndicateWithIndicateColor:(UIColor*)color;
- (void)endLoadingIndicate;

- (void)removeAllTouchUpInsideAction;

@end
